<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <th:block th:replace="headfoot/head::head_common"></th:block>
</head>
<body>
<div class="container-fluid kj-list-container">
    <div class="kj-list-content-container card">
        <form id="queryForm" class="form-horizontal kj-list-queryFrom">

            <div class="kj-list-queryFrom-container">
                <div class="kj-list-queryFrom-item">
                    <div class="form-group col-sm-12">

                        <label class="col-sm-1 control-label kj-list-query-label" title="课程名称">课程名称</label>
                        <div class="col-sm-2">
                            <select class="form-control input-sm select2" id="courseId" name="courseId"
                                    data-url="/student/course/all">
                                <option value="">--请选择--</option>
                            </select>
                        </div>

                        <label class="col-sm-1 control-label kj-list-query-label" title="学期">学期</label>
                        <div class="col-sm-2">
                            <select class="form-control input-sm " id="term" name="term" data-value="" vic:dict="term"
                                    data-option="--请选择--">
                            </select>
                        </div>


                        <div class="col-sm-3 kj-list-query-btn-container">
                            <button type="button" class="btn btn-sm btn-default kj-btn-query query">
                                <i class="iconfont icon-chaxun"></i> 查询
                            </button>
                            <button type="button" class="btn btn-sm btn-default kj-btn-reset reset">
                                <i class="iconfont icon-zhongzhi"></i>重置
                            </button>
                        </div>

                    </div>

                </div>
            </div>

            <!-- 收起展开按钮 -->
            <div class="kj-packUpdiv">
                <span class="kj-packUp-span">
                    <i id="kj_slideBtn" class="kj-packUpdiv-icon kj-icon-shou-by-listpage"
                       onclick="common.slideSearchDiv();"></i>
                </span>
            </div>

            <div id="kj_list_content_btn_container"
                 class="kj-list-content-btn-container form-group col-sm-12">
            </div>
        </form>

        <table
                id="table"
                class="table table-bordered table-hover table-striped bootstrapTable kj-list-container-only-table"
                data-list-url="/personal/scoreList"
                data-toolbar="#queryForm"
                data-height="800"
        >
            <thead>
            <tr>
                <th data-checkbox="true"></th>
                <th data-field="number" data-sortable="true">学号</th>
                <th data-field="studentName" data-sortable="true">姓名</th>
                <th data-field="termName" data-sortable="true" data-sort-name="term">学期</th>
                <th data-field="courseName" data-sortable="true" data-sort-name="courseId">课程</th>
                <th data-field="score" data-sortable="true" data-class="score">成绩</th>
            </tr>
            </thead>
        </table>
    </div>


    <div class="hidden hidden-template">
        <div class="row">

                <div class="form-group">
                    <label class="col-md-7 control-label kj-form-container-content-label text-info"></label>
                    <div class="col-md-5 validateDiv">
                        <input	class="form-control input-sm kj-form-container-content-input"
                                  id="score"
                                  type="text"
                                  placeholder="分数"
                                  />
                    </div>

                </div>

        </div>

    </div>
</div>

<th:block th:replace="headfoot/foot::list_foot"></th:block>
<script>

    function mineOperate(value, row, index, field) {
        var html = defaultOperate(value, row, index, field);
        html += '<a  href="#!" data-id="' + row.id +
            '" class="btn btn-xs btn-default score-btn in-table" title="录入分数" data-toggle="tooltip" data-confirm=""><i class="mdi mdi-pencil"></i></a>';
        ;
        return html;
    }

    var mineOperateEvent = $.extend({}, defaultOperateEvent, {
        //录入分数事件
        'click .score-btn': function(event, value, row, index) {
            var $this = $(event.target);

            var id = row.id;
            var $html = $(".hidden-template .row").clone();
            var lable = row.studentName +"(" + row.number +")-" + row.courseName;
            var score =row.score;
            $html.find("label").text(lable);
            $html.find("input").val(score);
            var url ="/student/selection/recordScore"
            common.confirm("$html",function (){
                var $content = this.$content
                var score = $("input", $content).val();
                var data ={
                    id:id,score:score
                };
                $request.post(url,{data:data},function(){
                $("table").bootstrapTable('refresh');
                })
            }, {
                onContentReady: function(){
                    this.setContent($html);
                },
                title:"录入分数"
            })

        }
    });

</script>

</body>
</html>